package com.efuture.servlet.response;

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @description: 将字符输出到浏览器
 * @author zhaoshanshan
 * @date 2021/10/3 11:33 上午
 * @version 1.0
 */
@WebServlet("/CharacterOutput")
public class CharacterOutput extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");//防止乱码问题
        PrintWriter writer = response.getWriter();
        writer.write("我是测试字符输出数据到浏览器");
    }
}
